/*
 * NextAction.java
 *
 * Created on June 22, 2005, 8:33 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */
package com.bff.slimserver.musicjukebox.lib.actions;

import com.bff.slimserver.musicjukebox.ui.MainFramePlayer;
import com.bff.bjj.utils.Resources;
import java.awt.event.ActionEvent;
import javax.swing.*;

/**
 *
 * @author Bill
 */
public class MinimizeAction extends AbstractAction {

    private boolean minimized = false;

    /** Creates a new instance of StopAction */
    public MinimizeAction() {
        super(Resources.getMessage(Resources.LABEL_KEY.ACTION_MINIMIZE_NAME));

        putValue(Action.SMALL_ICON, Resources.getIcon(Resources.ICON_KEY.ACTION_MINIMIZE));
        putValue(Action.MNEMONIC_KEY, Resources.getKeyEvent(Resources.KEYEVENT_KEY.ACTION_MINIMIZE));
        putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(Resources.getKeystroke(Resources.KEYSTROKE_KEY.KEYSTROKE_MINIMIZE)));
        putValue(Action.SHORT_DESCRIPTION, Resources.getMessage(Resources.LABEL_KEY.ACTION_MINIMIZE_SHORT_DESC));
    }

    @Override
    public void actionPerformed(ActionEvent evt) {
        if (isMinimized()) {
            putValue(Action.SMALL_ICON, Resources.getIcon(Resources.ICON_KEY.ACTION_MINIMIZE));
            MainFramePlayer.maximizePanel();
            setMinimized(false);
        } else {
            putValue(Action.SMALL_ICON, Resources.getIcon(Resources.ICON_KEY.ACTION_MAXIMIZE));
            MainFramePlayer.minimizePanel();
            setMinimized(true);
        }
    }

    /**
     * @return the minimized
     */
    public boolean isMinimized() {
        return minimized;
    }

    /**
     * @param minimized the minimized to set
     */
    public void setMinimized(boolean minimized) {
        this.minimized = minimized;
    }
}
